package Z03JiHeKuangJia.QiTaJiHe.T03HashMap;

import java.util.HashMap;

public class TestHashMap {}

class TestHashMap1{
    public static void main(String[] args) {
        HashMap<String ,String> dictionary = new HashMap<>();
        dictionary.put("abc","物理英雄");
        dictionary.put("apc","魔法英雄");
        dictionary.put("t","坦克英雄");

        System.out.println(dictionary.get("t"));


        HashMap<String,Hero> heroHashMap = new HashMap<>();
        heroHashMap.put("gareen",new Hero("timmer"));
        System.out.println(heroHashMap);

        heroHashMap.put("gareen",new Hero("dalong"));
        System.out.println(heroHashMap);

        heroHashMap.put("Test" ,new Hero("gailun"));
        System.out.println(dictionary);

        dictionary.clear();

        heroHashMap.put("test1",new Hero("1"));
        heroHashMap.put("test2",new Hero("1"));

    }
}

class Hero{
    public String name;
    public float hp;
    public int damage;

    public Hero(){}
    public Hero(String name){
        this.name = name;
    }
    public String toString(){
        return name;
    }
}